package com.gz.steak.common.exception;

/**
 * @Author 刘牌
 * @Date 2020/2/22 0022 18:58
 * @Version 1.0
 */

public enum EmBusinessError implements CommonError{
    /**
     * 通用错误类型
     */
    PARAMETER_VALIDATION_ERROR(10001,"参数不合法"),
    UNKNOWN_ERROR(10002,"未知错误,请联系管理员"),

    USER_NOT_EXIST(20001,"用户不存在"),
    PASSWORD_ERROR(20002,"密码错误"),
    USER_LOGIN_IN_ANOTHER(20003,"账号在其他地方登陆，请你重新登陆"),
    IDENTITY_EXPIRED(20004,"当前登陆状态已过期，请重新登陆"),
    CAPTCHA_ERROR(20005,"验证码错误，请重新输入"),

    RESULT_NULL(30001,"没有记录"),

    //权限
    NO_LOGIN(40002,"请登陆后再操作"),
    NO_AUTH(40001,"对不起,您没有操作权限"),

    //数据库
    USER_ALREADY_EXISTS(50001,"用户已经存在，不能重复添加")
    ;

    private int errorCode;
    private String errorMsg;

    EmBusinessError(int errorCode, String errorMsg) {
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    @Override
    public int getErrorCode() {
        return this.errorCode;
    }

    @Override
    public String getErrorMsg() {
        return this.errorMsg;
    }

    @Override
    public CommonError setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
        return this;
    }

}
